#include "CPoint.h"
#include <cmath>
#include <iostream>

using namespace std;

CPoint::CPoint(): fx(0.0), fy(0.0){}
CPoint::CPoint(float inFx, float inFy): fx(inFx), fy(inFy){}
CPoint::CPoint(const CPoint &inPoint): fx(inPoint.fx), fy(inPoint.fy){}

float CPoint::GetFx(){
	return fx;
}

void CPoint::SetFx(float inFx){
	fx = inFx;
}

float CPoint::GetFy(){
	return fy;
}

void CPoint::SetFy(float inFy){
	fy = inFy;
}

void CPoint::SetCPoint(float inFx, float inFy){
	fx = inFx;
	fy = inFy;
}

float CPoint::GetDistance(CPoint inPoint){
	double tempX, tempY;
	tempX = inPoint.fx - this->fx;
	tempY = inPoint.fy - this->fy;
	return (float)sqrt(tempX * tempX + tempY * tempY);
}

void CPoint::CopyCPoint(CPoint inPoint){
	CPoint::SetCPoint(inPoint.GetFx(), inPoint.GetFy());
}

void CPoint::CoutCPoint(){
	cout << fx << " " << fy << endl;
}

bool CPoint::ifOutOfBorder(float X1, float Y1, float X2, float Y2){
	bool result = false;
	if(fx < X1 || fx > X2 || fy < Y1 || fy > Y2)
		result = true;
	return result;
}

void CPoint::PlusCPoint(CPoint inPoint){
	fx += inPoint.fx;
	fy += inPoint.fy;
}